package com.example.demo.mapper;

import com.example.demo.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Select("select * from big_event.user where username=#{username}")
    User findByUserName(String username);
    //添加用户到数据库
    @Insert("INSERT INTO big_event.user(username,password,create_time,update_time) VALUES " +
            "(#{username},#{s},now(),now())")
    void add(String username, String s);
    //更新用户基本信息
   /* @Update("update big_event.user set nickname=#{nickname},email=#{email},update_time=now() where id=#{id}")
    void update(User user, Integer id);*/
    @Update("update big_event.user set nickname=#{user.nickname}, email=#{user.email}, update_time=now() where id=#{id}")
    void update(@Param("user") User user, @Param("id") Integer id);
    //更新用户密码
    @Update("update big_event.user set password=#{md5String},update_time=now() where id=#{id}")
    void updatePwd(String md5String, Integer id);
}
